{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "0",
   "metadata": {},
   "source": [
    "<a href=\"https://githubtocolab.com/gee-community/geemap/blob/master/docs/notebooks/131_arcgis.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open in Colab\"/></a>\n",
    "\n",
    "**Using Earth Engine with ArcGIS Pro**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1",
   "metadata": {},
   "outputs": [],
   "source": [
    "# !pip install -U geemap"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2",
   "metadata": {},
   "source": [
    "## Step 1 - Open ArcGIS Python Command Prompt\n",
    "\n",
    "Navigate to the **Start Menu -> All apps -> ArcGIS** folder, then open the **Python Command Prompt**.\n",
    "\n",
    "## Step 2 - Create a conda environment\n",
    "\n",
    "Create a fresh conda env to install arcpy and geemap with the following commands within the Python Command Prompt:\n",
    "\n",
    "```bash\n",
    "conda create conda-forge::mamba esri::python -n gee\n",
    "conda activate gee\n",
    "mamba install arcpy geemap -c esri -c conda-forge\n",
    "proswap gee\n",
    "```\n",
    "\n",
    "## Step 3 - Create a New Notebook\n",
    "\n",
    "To create a notebook, click the **Insert** tab on the ArcGIS Pro ribbon, and click the **New Notebook** button. Alternatively, open the **Catalog** pane, browse to your project directory, right-click a folder, and select **New > Notebook**.\n",
    "\n",
    "## Step 4 - Run GEE script\n",
    "\n",
    "Run any geemap code as usual. The `Map.addLayer()` function will automatically add Earth Engine layers to the active map. Use `Map.centerObject()` to center an Earth Engine object on the map."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "3",
   "metadata": {},
   "outputs": [],
   "source": [
    "import ee\n",
    "import geemap"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4",
   "metadata": {},
   "source": [
    "Add Earth Engine layers."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "5",
   "metadata": {},
   "outputs": [],
   "source": [
    "Map = geemap.Map()\n",
    "dem = ee.Image(\"USGS/SRTMGL1_003\")\n",
    "vis_params = {\n",
    "    \"min\": 0,\n",
    "    \"max\": 4000,\n",
    "    \"palette\": \"terrain\",\n",
    "}\n",
    "Map.addLayer(dem, vis_params, \"SRTM DEM\")\n",
    "Map"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6",
   "metadata": {},
   "source": [
    "Center an Earth Engine object on the map."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7",
   "metadata": {},
   "outputs": [],
   "source": [
    "Map = geemap.Map()\n",
    "image = (\n",
    "    ee.Image(\"LANDSAT/LC09/C02/T1_L2/LC09_044034_20220503\")\n",
    "    .select(\"SR_B.\")\n",
    "    .multiply(0.0000275)\n",
    "    .add(-0.2)\n",
    ")\n",
    "\n",
    "vis_params = {\"bands\": [\"SR_B5\", \"SR_B4\", \"SR_B3\"], \"min\": 0, \"max\": 0.3}\n",
    "\n",
    "Map.addLayer(image, vis_params, \"Landsat 9\")\n",
    "Map.centerObject(image)\n",
    "Map"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
